<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="../inc.jsp"></jsp:include>
		<script type="text/javascript" charset="utf-8">
		var id =${id};
		var datagrid;
		$(function() {
			$('form input').bind('keyup', function(event) {/* 增加回车提交功能 */
			if (event.keyCode == '13') {
				_search();
			}
			});
			datagrid = $('#datagrid').datagrid({
				url : 'orderAction!noAuth_checkItems.html?model.id='+id,
				title : '入库商品列表',
				iconCls : 'icon-save',
				pagination : true,
				pagePosition : 'bottom',
				pageSize : 10,
				pageList : [ 10, 20, 30, 40 ],
				fit : true,
				fitColumns : false,
				nowrap : false,
				border : false,
				idField : 'id',
				sortName : 'id',
				sortOrder : 'desc',
				checkOnSelect : false,
				columns : [ [ 
				{
					title : '商品条码',
					field : 'barcode',
					width : 130,
				}, {
					title : '款号',
					field : 'gtype',
					width : 110,
				}, {
					title : '商品名称',
					field : 'gname',
					width : 110
				} , {
					title : '品牌',
					field : 'bname',
					width : 90
				} , {
					title : '商品类别',
					field : 'gtname',
					width : 100,
					align:'center'
				}, {
					title : '单位',
					field : 'unit',
					width : 60,
					align:'center'
				} , {
					title : '颜色',
					field : 'color',
					width : 70,
					align:'center'
				} , {
					title : '尺码',
					field : 'size',
					width : 70,
					align:'center'
				} , {
					title : '进价',
					field : 'buyPrice',
					width : 80,
					align:'center'
				} , {
					title : '入库数',
					field : 'num',
					width : 80,
					align:'center'
				}] ]
				
			});
			
			
			var rid = $('#orderForm').find('input[name=rid]');
			var ridCombobox = rid.combobox({
				url : '${pageContext.request.contextPath}/rkgl/repertoryAction!noAuth_combobox.html',
				valueField : 'id',
				textField : 'name',
				multiple : false,
				editable : false,
				panelHeight : 'auto',
				onLoadSuccess : function() {
					parent.$.messager.progress('close');
				}
			});
			var uid = $('#orderForm').find('input[name=uid]');
			var uidCombobox = uid.combobox({
				url : '${pageContext.request.contextPath}/qxgl/userAction!noAuth_userInReperCombobox.html',
				valueField : 'id',
				textField : 'username',
				multiple : false,
				editable : false,
				panelHeight : 'auto',
				onLoadSuccess : function() {
					parent.$.messager.progress('close');
				}
			});
		
			$.ajax({
				url : '${pageContext.request.contextPath}/rkgl/orderAction!noAuth_checkOrder.html',
				data : {id : id},
				type : "POST",
				success : function(d){
					var json = $.parseJSON(d);
					//alert(d);
					var f = $('#orderForm');
					f.form("load",{
						id : json[0].id,
						date : json[0].date,
						serial : json[0].serial,
						rid : json[0].rid,
						uid : json[0].uid,
						remark : json[0].remark
					});
				}
			});
			
		});
	function _search() {
		datagrid.datagrid('load', sy.serializeObject($('#searchForm')));
	}
	
	function cleanSearch() {
		datagrid.datagrid('load', {});
		$('#searchForm input').val('');
	}
	</script>
	</head>
	<body class="easyui-layout" data-options="fit:true">
	
		<div data-options="region:'north',border:false" style="height: 105px; overflow: hidden;">
			<form id="orderForm" style="height:100px;">
				<input id="items" name="items" type="hidden" />
				<table class="tableForm datagrid-toolbar" style="width: 100%; height: 100%;">
					<tr>
						<th style="width: 80px;">日&nbsp;&nbsp;&nbsp;&nbsp;期</th>
						<td style="width: 200px;"><input name="date" class="easyui-datebox orderDate" data-options="editable:false" style="width: 200px;" /></td>
						<th style="width: 80px;">单&nbsp;&nbsp;号</th>
						<td style="width: 200px;"><input name="serial" style="width: 200px;" value=""/></td>
					</tr>
					<tr>
						<th style="width: 80px;">入库仓库 </th>
						<td style="width: 200px;"><input name="rid" style="width: 200px;" /></td>
						<th style="width: 80px;">操作员</th>
						<td style="width: 200px;"><input name="uid" style="width: 200px;"/></td>
					</tr>
					<tr>
						<th>备&nbsp;&nbsp;&nbsp;&nbsp;注</th>
						<td colspan="1"><textarea name="remark" style="height:30px; 200px;"></textarea></td>
						<td colspan="2">
							<a href="javascript:void(0);" class="easyui-linkbutton"
								onclick="_search();">搜索</a><a href="javascript:void(0);"
								class="easyui-linkbutton" onclick="cleanSearch();">取消</a>
						</td>
					</tr>
				</table>
			</form>
		</div>
	
		<div data-options="region:'center',border:false" style="overflow: hidden;">
			<table id="datagrid"></table>
		</div>
	</div>
	</body>
</html>